package com.lzq.his.controller;

import com.lzq.his.domain.Dept;
import com.lzq.his.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/dept")
public class DeptController {

    @Autowired
    private DeptService deptService;

    @GetMapping
    public List<Dept> selectAll() {
        return deptService.selectAll();
    }

    @PostMapping("/save")
    public void save(@RequestBody Dept dept) {
        System.out.println(dept);
        deptService.save(dept);
    }

    @DeleteMapping("/delete/{id}")
    public void deleteDept(@PathVariable String id) {
        deptService.deleteById(id);
    }
}
